local delay = 1 -- in seconds
local log = ngx.log
local ERR = ngx.ERR
local grafana = require "grafana_m"

handler = function()
    grafana:new()
    grafana:handler()
end

if 0 == ngx.worker.id() then
    local ok, err = ngx.timer.every(delay, handler)
    if not ok then
        log(ERR, "failed to create timer: ", err)
        return
    end
end